<ion-header>
  <ion-toolbar>
    <ion-buttons left>
      <button ion-button icon-left (click)="navBack()">
        <ion-icon class="nav-back" name="arrow-back"></ion-icon>
      </button>
    </ion-buttons>

    <ion-title>{{"passwordTitle" | translate}}</ion-title>
  </ion-toolbar>
</ion-header>

<ion-content>
  <ion-list inset>
    <form [formGroup]="group" novalidate autocomplete="off">
    <ion-item>
      <ion-label>
        <ion-icon name="person" class="hst-color" item-start></ion-icon>
      </ion-label>
      <ion-input type="text" placeholder="{{'usernameTips' | translate}}" formControlName="username"></ion-input>
      <button icon-only ion-button clear color="danger" type="button" item-right (click)="clearUsername()">
        <ion-icon name="close"></ion-icon>
      </button>
    </ion-item>

    <ion-item>
      <ion-label>
        <ion-icon name="code" class="hst-color" item-start></ion-icon>
      </ion-label>
      <ion-input placeholder="{{'vcodeTips' | translate}}" formControlName="vcode"></ion-input>
      <button ion-button class="code-btn" color="primary" type="button" item-right (click)="getVerificationCode()">{{getCodeText()}}</button>
    </ion-item>

    <ion-item>
      <ion-label>
        <ion-icon name="lock" class="hst-color" item-start></ion-icon>
      </ion-label>
      <ion-input *ngIf="!showPassword" placeholder="{{'passwordTips' | translate}}" type="password" formControlName="password"></ion-input>
      <ion-input *ngIf="showPassword" placeholder="{{'passwordTips' | translate}}" type="text" formControlName="password"></ion-input>
      <button icon-only ion-button clear [color]="showPassword ? 'calm' : 'dark'" type="button" item-right (click)="showPassword = !showPassword">
        <ion-icon name="eye"></ion-icon>
      </button>
    </ion-item>
    </form>

    <button class="password-btn" ion-button full color="light" (click)="changePassword()" [disabled]="group.invalid">{{"changePassword" | translate}}</button>
  </ion-list>
</ion-content>
